package com.key.web_admin.controller;

import com.key.common.base.RespResult;
import com.key.modules.dto.ECConditionDTO;
import com.key.modules.dto.ECustomersDTO;
import com.key.modules.service.ECustomersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/eCustomers")
public class ECustomersController {

    @Autowired
    private ECustomersService eCustomersService;

    @PostMapping("/addECustomers")
    public RespResult addICustomers(@RequestBody ECustomersDTO eCustomersDTO){

        return eCustomersService.addECustomers(eCustomersDTO);
    }

    @GetMapping("/findAllECustomers")
    public RespResult findAllECustomers(@RequestBody ECConditionDTO ecConditionDTO){

        return eCustomersService.findAllECustomers(ecConditionDTO);
    }

    @GetMapping("/findECustomersById")
    public RespResult findECustomersById(@RequestParam("id") Integer id){

        return eCustomersService.findECustomersById(id);
    }

    @PostMapping("/updateECustomers")
    public RespResult updateECustomers(@RequestBody ECustomersDTO eCustomersDTO){

        return eCustomersService.updateECustomers(eCustomersDTO);
    }

    @PostMapping("/deleteECustomers")
    public RespResult deleteECustomers(@RequestBody List<Integer> ids){

        return eCustomersService.deleteECustomers(ids);
    }

    @PostMapping("/disDSta")
    public RespResult disDSta(@RequestBody List<Integer> ids){
        return eCustomersService.disDSta(ids);
    }

    @PostMapping("/enDSta")
    public RespResult enDSta(@RequestBody List<Integer> ids){
        return eCustomersService.enDSta(ids);
    }
}
